package com.rfsp.common.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.rfsp.common.base.BaseMapper;
import com.rfsp.common.pojo.po.UserPO;
import com.rfsp.common.pojo.vo.PrivilegeVO;
import org.springframework.stereotype.Repository;

@Repository
public interface UserMapper extends BaseMapper<UserPO> {
	
	@Select("SELECT * FROM m_user o WHERE o.user_code=#{userCode}")
	public UserPO getUserByUserCode(@Param("userCode") String userCode);
	
	@Select("select * from m_user u where u.user_code = #{userCode} and u.password = #{password} ")
	public UserPO getUserByNameAndPwd(@Param("userCode") String userCode, @Param("password") String password);
	
	@Select("SELECT * FROM M_USER U WHERE U.CA_SUBJECTION=#{caSubjection}")
	public UserPO getUserByCaSubjection(@Param("caSubjection") String caSubjection);

	@Select("SELECT * FROM M_USER U WHERE U.CA_SUBJECTION=#{caSubjection} and U.USER_STATUS <> '4'")
	public UserPO getUserByCaSubjectionAndUserStatusNot4(@Param("caSubjection") String caSubjection);
	
	//获取角色code
    public List<String> getUserRole(@Param("userCode") String userCode);
    
	//获取角色name
	public List<String> getUserRoleName(@Param("userCode") String userCode);
	
	  
	public List<PrivilegeVO> getUserPriv2(@Param("userCode") String userCode, @Param("superRightCode") String superRightCode);
	
	
	public List<String> getMobileNum(Map<String, Object> map);
	
	@Select("select session_id from spring_session t where t.PRINCIPAL_NAME =#{userCode} ")
	public String getUserSession(String userCode);
	
	
	@Select("SELECT * FROM M_USER U WHERE U.ORG_ID = #{orgId}")
	public List<UserPO> getUserByOrgId(@Param("orgId") Long orgId);
	
	
	
	
}